import {PROGRAM} from '@/services/api'
import {request, METHOD} from '@/utils/request'

export async function listProgramByPage(currentPage, size) {
    return request(PROGRAM, METHOD.GET, {
        currentPage: currentPage,
        size: size
    })
}

export async function totalProgram() {
    return request(PROGRAM+"/total", METHOD.GET)
}

export async function details(gradeId, majorId) {
    return request(PROGRAM+"/details", METHOD.GET, {
        gradeId: gradeId,
        majorId: majorId
    })
}

export async function copy(param) {
    return request(PROGRAM+"/copy", METHOD.POST, {
        gradeId: param.gradeId,
        majorId: param.majorId,
        oldGrade: param.oldGrade,
        oldMajor: param.oldMajor
    })
}

export async function deleteProgram(id) {
    return request(PROGRAM, METHOD.DELETE, {
        id: id
    })
}

export async function editProgram(program) {
    return request(PROGRAM, METHOD.POST, {
        id: program.id,
        courseId: program.courseId,
        gradeId: program.gradeId,
        majorId: program.majorId,
        experimental: program.experimental,
        theoretical: program.theoretical,
        credit: program.credit,
        method: program.method,
        term: program.term
    })
}
